home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
404_02
/
MyCompiler.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-12
|
1KB
|
53 lines
static char SccsId[]="%Z% %M% %Y% %Q% %I% %E% %U% (%F%)";
//
// Nom du Fichier : |>nom_fichier<|
// Titre : |>Titre<|
// Auteur: |>auteur<|
// Date de creation : |>dateCreation<|
//
// Description :
// Document de reference : |>doc<|
// Objet : |>objet<|
//
//
//
// historique :
// |>date<| |>auteur<| |>objet<|
//
#include "MyScanner.h"
#include "MyParser.h"
class MyCompiler : public MyParser
{private:
MyScanner theScanner;
public:
virtual int yylex();
virtual void yyerror(char *m);
MyCompiler()
{};
};
int MyCompiler::yylex()
{
yylloc.first_line=theScanner.theLine;
yylloc.first_column=theScanner.theColumn;
int token=theScanner.yylex(&yylval,&yylloc);
yylloc.last_line=theScanner.theLine;
yylloc.last_column=theScanner.theColumn;
yylloc.text=(char *)theScanner.yytext;
return token;
}
void MyCompiler::yyerror(char *m)
{ fprintf(stderr,"%d: %s at token '%s'\n",yylloc.first_line, m,yylloc.text);
}
int main(int argc,char **argv)
{
MyCompiler aCompiler;
int result=aCompiler.yyparse();
printf("Resultat Parsing=%s\n",result?"Erreur":"OK");
return 0;
};